#Platform specific compile flags and project includes

SET(CMAKE_CXX_FLAGS "/GR- /GF /MP /Gy /d2Zi+ /errorReport:prompt /fp:fast /Gd /Gm- /GS- /nologo /W4 /WX /Zc:forScope /Zc:inline /Zc:wchar_t /Zi")

OPTION(STATIC_WINCRT "Use static WinCRT" OFF)

# Are we using the static or dynamic RT library? Whatever we use, it needs to be the same in any dependencies
#  we pull in or we're potentially having mismatch issues.
IF(STATIC_WINCRT)
	SET(WINCRT_NDEBUG "/MT")
	SET(WINCRT_DEBUG "/MTd")
ELSE()
	SET(WINCRT_NDEBUG "/MD")
	SET(WINCRT_DEBUG "/MDd")
ENDIF()

SET(CMAKE_CXX_FLAGS_DEBUG "/Od /RTCsu ${WINCRT_DEBUG}")
SET(CMAKE_CXX_FLAGS_CHECKED "/Ox ${WINCRT_NDEBUG}")
SET(CMAKE_CXX_FLAGS_PROFILE "/Ox ${WINCRT_NDEBUG}")
SET(CMAKE_CXX_FLAGS_RELEASE "/Ox ${WINCRT_NDEBUG}")

MESSAGE("STATIC OR DYN: ${WINCRT_DEBUG}")

# Build PDBs for all configurations
SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG")

IF(CMAKE_CL_64)
	ADD_DEFINITIONS(-DWIN64)
ENDIF(CMAKE_CL_64)				

SET(BLAST_SLN_COMPILE_DEFS _HAS_EXCEPTIONS=0;WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;)
#NvBlastExt doesn't have the _CONSOLE flag

SET(BLAST_SLN_DEBUG_COMPILE_DEFS _DEBUG;NV_DEBUG=1;)
SET(BLAST_SLN_CHECKED_COMPILE_DEFS NDEBUG;NV_CHECKED=1;)
SET(BLAST_SLN_PROFILE_COMPILE_DEFS NDEBUG;NV_PROFILE=1;)
SET(BLAST_SLN_RELEASE_COMPILE_DEFS NDEBUG;)

IF(CMAKE_CL_64)
	SET(LIBPATH_SUFFIX "x64")
ELSE(CMAKE_CL_64)
	SET(LIBPATH_SUFFIX "x86")
ENDIF(CMAKE_CL_64)				

SET(CMAKE_DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}_${LIBPATH_SUFFIX}")
SET(CMAKE_PROFILE_POSTFIX "${CMAKE_PROFILE_POSTFIX}_${LIBPATH_SUFFIX}")
SET(CMAKE_CHECKED_POSTFIX "${CMAKE_CHECKED_POSTFIX}_${LIBPATH_SUFFIX}")
SET(CMAKE_RELEASE_POSTFIX "${CMAKE_RELEASE_POSTFIX}_${LIBPATH_SUFFIX}")


# Include all of the projects
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlast.cmake)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastGlobals.cmake)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastTk.cmake)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastExtShaders.cmake)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastExtStress.cmake)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastExtPhysX.cmake)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastExtAuthoring.cmake)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastExtImport.cmake)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastExtAssetUtils.cmake)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastExtExporter.cmake)
# INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastExtRT.cmake)


SET(SERIALIZATION_INCLUDED 1 PARENT_SCOPE)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastExtSerialization.cmake)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastExtTkSerialization.cmake)
INCLUDE(${PROJECT_CMAKE_FILES_DIR}/NvBlastExtPxSerialization.cmake)
